import java.util.Scanner;

public class Max_gongyueshu {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        System.out.print("请输入第一个整数：");
        int num1 = scanner.nextInt();

        System.out.print("请输入第二个整数：");
        int num2 = scanner.nextInt();

        int gcd = calculate(num1,num2);
        System.out.println("最大公约数是："+ gcd);
    }

    public static int calculate(int num1,int num2){
        while(num2 != 0){
            int temp = num2;
            num2 = num1 % num2;
            num1 = temp;
        }
        return num1;
    }
}
